{% extends "base.html" %}

{%block title%}Suma liczb w losowaniu{%endblock%}

{%block head%}
    <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/jquery.jqplot.min.css" />
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}/js/jquery-ui.datepicker-pl.js"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $("#id_date").datepicker($.datepicker.regional['pl']);
        });
    </script>
       
    <script type="text/javascript" src="{{MEDIA_URL}}/js/jquery.jqplot.min.js"></script>
    <script type="text/javascript" src="{{MEDIA_URL}}/js/plugins/jqplot.highlighter.min.js"></script>

    <script type="text/javascript" language="javascript">
    $(document).ready(function(){
        var data = [{%for v in value%}{%if v%}[{{v}},{{forloop.counter}}],{%endif%}{%endfor%}];
        var plot1 = $.jqplot('chart', [data], {
            seriesDefaults: {
                showLine:false, 
                shadow:false
            },
            axes: {
                xaxis: {min: 0, tickInterval:5},
                yaxis: {min: 0, tickInterval:10}
            },
            highlighter: {
                show: true,
                sizeAdjust: 7.5
            }
        }); 
    });
    </script>
{%endblock%}

{% block content %}
	<div id="content">
		<div class="post">
			<div class="title">
				<h2>Suma liczb w losowaniu</h2>
			</div>
			<div class="entry">
			    <form method="POST" action="{%url total%}">
			    {% csrf_token %}
			        {{form.mode}} <span class="m-l">Od daty:</span> {{form.date}}
	                <input type="submit" id="pick" class="m-l" />
            	</form>
                <div id="chart" style="height:1200px; width:610px;"></div>
                <table class="values">
                	<tr>
			        	<th>Suma liczb</th>
			        	<th>Ilość wystąpień (>0)</th>
			    	</tr>
	                {%for v in value%}
	                {%if v%}
	                <tr>
	                    <td>{{forloop.counter}}</td>
	                    <td>{{v}}</td>
	                </tr>
	                {%endif%}
	                {%endfor%}
	            </table>
			</div>
		</div>
	</div>
{% endblock %}
